<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import= "model.filemanager.FileManager" %>
<%@ page import= "model.filemanager.MediaFile" %>
<%@ page import= "model.filemanager.MediaList" %>
<%@ page import= "view.*" %>
<%@ page import= "model.*" %>
<%@ page import= "java.util.Iterator" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import ="com.google.appengine.api.users.UserService" %>
<%@ page import ="com.google.appengine.api.users.UserServiceFactory" %>


<% 
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
String type = request.getParameter("type");

%>

<div id="centreDiv">
 <div id="contentDiv">
 	

 	
 	<div id="searchDiv" class="regPanel">
	 	<input type="text" value="" id="searchQuery" onkeydown="if(event.keyCode == 13){searchNavigate();}"/>
	 	<select id="searchParamSelect">
	 		<%
	 			//MediaType mediaType = MediaType.getMediaType(type);
	 				 		Iterator<MediaProperty> props = MediaType.getMediaType(type).getAllMediaProperties().iterator(); 
	 				 		MediaProperty prop;
	 				 		while(props.hasNext()){
	 				 			prop = props.next(); 
	 				 			if(prop.visible && prop.searchable){
	 		%>
		 		<option value="<%=prop.name%>" ><%=prop.displayName%></option>
	 		<%
	 			} }
	 		%>
	 	</select>
	 	<input type="button" value="Search" onClick="searchNavigate()"/>
	 </div>
		
	 <div id="listTabs"></div>	
	 
	 <a href="#" id="toggleColumnsLink" class="reg_button" onclick="toggleInfoDisplay(true)">Edit Columns</a>

	 <div id="columnsDiv">
	 	<form id='columnsForm'>
	 			 		<%
	 			 			//MediaType mediaType = MediaType.getMediaType(type);
	 			 			 			 				 		props = MediaType.getMediaType(type).getAllMediaProperties().iterator(); 
	 			 			 			 				 		while(props.hasNext()){
	 			 			 			 				 			prop = props.next(); 
	 			 			 			 				 			if(prop.visible) {
	 			 		%>
		 		<div><%=prop.displayName%><input type="checkbox" id='checkbox_<%= prop.name %>' onclick="toggleColumn('<%= prop.name %>')" <%=prop.defaultShown ? "checked" : "" %> value="<%=prop.name%>"/></div>
	 		<%}} %>
	 	</form>
	 </div>
	 
 	<div id="tableDiv">
 		<img id="loadingImage" src='images/ajax-loader.gif' />
 	</div>
 </div> 
 <div id='hiddenVideoDiv' style="display:none"></div>
</div>